# Contributor: Pedro Filipe <xpecex@outlook.com>
# Contributor: G.J.R. Timmer <gjr.timmer@gmail.com>
# Maintainer: G.J.R. Timmer <gjr.timmer@gmail.com>
# TODO: run tests!
pkgname=check_postgres
pkgver=2.26.0
pkgrel=0
pkgdesc="PostgreSQL monitoring script"
url="https://bucardo.org/check_postgres/"
arch="noarch"
license="BSD-2-Clause"
depends="postgresql perl-dbd-pg"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/bucardo/check_postgres/archive/$pkgver.tar.gz"
options="!check" # failing tests

build() {
	perl Makefile.PL \
		INSTALL_BASE=/usr \
		INSTALLMAN1DIR=/usr/share/man/man1 \
		INSTALLSITEMAN1DIR=/usr/share/man/man1 \
		INSTALLMAN3DIR=/usr/share/man/man3 \
		INSTALLSITEMAN3DIR=/usr/share/man/man3
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install

	# Fix file extension because MakeMaker cannot do this
	mv "$pkgdir"/usr/bin/check_postgres.pl "$pkgdir"/usr/bin/check_postgres
}

sha512sums="
020a765cdf47ae5a76a5de80cfcd196f2ac476ee931bf42a6cb6eaab39ae2a729f7eac0c14d3e13cca443fdc48806043faad9c55bb84c9f4469d502b80e470cb  check_postgres-2.26.0.tar.gz
"
